from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
# 权限的模型类
from django.contrib.auth.models import Permission, ContentType,Group

from meiduo_admin.serializers.group import GroupSerializer,PermissionTypeSerializer
from meiduo_admin.utils import PageNum1


class GroupViewSet(ModelViewSet):
    queryset = Group.objects.all()
    serializer_class = GroupSerializer
    pagination_class = PageNum1

    def simple(self, request):
        data = Permission.objects.all()
        ser = PermissionTypeSerializer(data, many=True)
        return Response(ser.data)
